AppleScript

This section gives an overview of SoundApp’s support for the AppleEvent Object Model and AppleScript. Not everything is documented here. For more information, see your documentation on AppleScript and the Scripting Dictionary of SoundApp using your favorite script editor.

Script Menu
SoundApp supports a script menu which allows scripts to be executed directly from a menu in SoundApp. In order to utilize this feature, create a folder called “Script Menu Items” in the same directory as the SoundApp application. Then place compiled scripts into the folder and launch SoundApp. A new “Script” menu will be added to the menu bar, listing the scripts in the folder. Simply select one to run it. Scripts can direct SoundApp or other applications to do just about anything.

Application
In addition to the Core Suite of open, run, and quit (print is not supported), SoundApp supports the following verbs:

◊ convert alias, alias list, string, string list [to alias, alias list, string, string list] [encoding PCM, µLaw, IMA] [channels default, mono, stereo] [bits default, eight, sixteen] [rate rate] [law full, reduced, smart] [with(out) DOSify] [as System7, suitcase, AIFF, Wave, AU, NeXT, SD, QuickTime]: Converts the specified file(s) to the destination file(s). If multiple source files are specified and a single destination, the destination is assumed to be a folder. If no to parameter is specified, the default conversion output method is used (as specified in the Convert pane of the Preferences dialog). The encoding, channels and bits parameters allow the encoding, channel and bit resolution setting to be overridden. The rate parameter allows the output sampling rate setting to be changed. If these are omitted, the value specified in the Convert pane of the Preferences dialog will be used. The law parameter controls whether µ-law and a-law files are converted as 16-bit (full), 8-bit (reduced) or 8-bit with smart processing (smart). The DOSify parameter causes new output file names to be created with the archaic MS-DOS 8.3 filename format. This is ignored if a single file is converted and the to parameter is specified. The as parameter allows the output sound format to be specified. Again, if it’s not specified, the default in the Convert pane of the Preferences dialog will be used instead.

◊ play alias, alias list, string, string list [bits default, eight, sixteen] [law full, reduced, smart] [buffer size] [MODDriver trecker, preferTrecker, preferZSS, ZSS] [MODStereo mono, stereo, enhanced] [with(out) MODFilter] [with(out) MODSixteen] [with(out) MODTempMem] [MODVolume volume] [modRate rate] [MIDIDriver QuickTime, OMS] [with(out) sendGMReset] [with(out) ignoreSysEx]: Plays the file or files passed as the direct parameter. The bits and law parameters function as above. The buffer parameter specifies the size in kilobytes of the buffer used for double-buffering. A value of zero means don’t double-buffer; otherwise, the value must be at least 64. The MODDriver, MODtereo, MODixteen, MODilter, MODTempMem, MODRate and modVolume parameters control the “MOD Driver,” “Stereo Mode,” “Real-Time Filter,” “16-Bit,” “Use System Memory,” “Playback Rate” and “Volume” settings in the MOD pane of the Preferences dialog respectively. The MIDIDriver, sendGMReset and ignoreSysEx parameters control the “MIDI Driver,” “Send General MIDI Reset,” and “Ignore SysEx Messages” settings in the MIDI pane of the Preferences dialog respectively. The volume value must be at least zero and no more than 255. The rate value must be at least 8000 and no more than 48000. 

◊ get information alias, alias list, string, string list: Opens an information window for each of the specified files.

◊ get status: Returns one of idle, busy, paused indicating what SoundApp is currently doing.

◊ set status to paused, next, previous, stopped: Changes the current activity status of SoundApp. “Paused” pauses or resumes playback, “next” and “previous” jump to the next or previous file and “stopped” stops processing immediately.

◊ get preferences: Returns a record containing a list of all the global preferences.

◊ set preferences to preference: value …: Changes one or all of the global preferences based on a specified record. Single preferences can be operated on directly if desired, e.g. set autoQuit to true.

◊ get conversion setting specifier: Retrieves the indexed or named conversion setting. The object conversion settings can be used to retrieve a list of all of them.

◊ get setting of conversion setting: Retrieves an attribute from the specified conversion setting.

◊ set setting of conversion setting to specifier: Sets an attribute of the specified conversion setting to the specified value.

◊ set convert settings save flag to true, false: Sets an internal flag which controls whether to save the conversion settings whenever they are changed via an AppleEvent. This can speed processing, but the settings will be lost when SoundApp exits. This flags has no effect when changing the settings via the menus.

◊ get convert settings save flag: Returns the value of the internal flag which can be set with the above command.

◊ show about, help window: Opens the About window and displays either the About or Help pane, respectively. You can use “set/get pane” to manipulate the current pane in the window.

◊ yield: Yields time to SoundApp to process files. This can be used in an AppleScript loop which waits for status to go to idle to determine when SoundApp is done.

Play Lists
Play lists are references as a document in SoundApp. The following verbs can be used on them:

◊ insert into document files file at position: Inserts the specified file at the specified position (an integer) in the list.

◊ play from entries selected, list of entries: Plays either the currently selected entries or the list of entries specified.

◊ convert from entries selected, list of entries: Converts either the currently selected entries or the list of entries specified.
 
◊ get information from entries selected, list of entries: Gets information for either the currently selected entries or the list of entries specified.

◊ delete entry: Removes the specified entry from the list.

◊ move entry to location: Moves the specified entry to another location  in the list.

◊ duplicate entry to location: Creates a copy of the specified entry at another location in the list.

◊ set shuffle, repeatProcessing to true, false: Changes the value of the Shuffle and Repeat checkboxes.

◊ get shuffle, repeatProcessing: Retrieves the value of the Shuffle and Repeat checkboxes.

◊ get sort mode: Retrieves the sorting mode. Valid values are none, by name and by type.

◊ set sort mode to none, by name, by type: Retrieves or changes the sorting mode.

◊ get selection: Retrieves the current selection.

◊ set selection to entry, list of entries: Changes the selection to the specified entry or entries.

Objects
The following objects are supported:

◊ application: The SoundApp application.

◊ document: A Play List document. Documents can only be referenced by name.

◊ entry: An entry in a Play List.

◊ conversion setting: A list containing all the output setting parameters.

◊ preferences record: A record consisting of all the SoundApp global preferences. Settings in the Convert menu are not included here.